package com.itcast.cn.request;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

/**
 *  跳转
 *
 * @author hyatt
 * @version 1.0
 */
@WebServlet("/request4")
public class RequestTest4 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("RequestTest4 start ....");

        // 添加request的属性
        request.setAttribute("msg", "hello");
        // 跳转
        request.getRequestDispatcher("/request5").forward(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doGet(request, response);
    }
}
